set ws=WScript.CreateObject("WScript.Shell")
dim cmd
cmd=""
cmd ="wsl -d Ubuntu-20.04 -u root ip addr del $(ip addr show eth0 | grep 'inet\b' | awk '{print $2}' | head -n 1) dev eth0;" 
cmd=cmd + "ip addr add 192.168.50.2/24 broadcast 192.168.50.255 dev eth0;"
cmd=cmd + "ip route add 0.0.0.0/0 via 192.168.50.1 dev eth0;"
cmd=cmd + "echo nameserver 192.168.50.1 > /etc/resolv.conf;"
cmd = cmd +"service apache2 start"
ws.run cmd ,0
ws.run "powershell -WindowStyle Hidden -c ""Get-NetAdapter 'vEthernet (WSL)' | Get-NetIPAddress | Remove-NetIPAddress -Confirm:$False; New-NetIPAddress -IPAddress 192.168.50.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (WSL)'; Get-NetNat | ? Name -Eq WSLNat | Remove-NetNat -Confirm:$False; New-NetNat -Name WSLNat -InternalIPInterfaceAddressPrefix 192.168.50.0/24;""" ,0
ws.run "netsh interface portproxy add v4tov4 listenport=80 listenaddress=0.0.0.0 connectport=80 connectaddress=192.168.50.2",0